HA$PBExportHeader$w_paramreport.srw
forward
global type w_paramreport from window
end type
type dw_1 from datawindow within w_paramreport
end type
type lv_1 from listview within w_paramreport
end type
type cb_3 from commandbutton within w_paramreport
end type
type cb_2 from commandbutton within w_paramreport
end type
type cb_1 from commandbutton within w_paramreport
end type
type uo_1 from u_cst_statictext within w_paramreport
end type
end forward

global type w_paramreport from window
integer width = 2418
integer height = 1020
boolean titlebar = true
string title = "Mas Reportes"
boolean controlmenu = true
windowtype windowtype = response!
long backcolor = 67108864
string icon = "AppIcon!"
boolean center = true
dw_1 dw_1
lv_1 lv_1
cb_3 cb_3
cb_2 cb_2
cb_1 cb_1
uo_1 uo_1
end type
global w_paramreport w_paramreport

type variables
u_cst_tabcontrol iuo_parent
userobject  iuo_report
STRING is_dw,is_titulo,is_window,is_idmenu

integer ii_tabindex,ii_index,ii_report,ii_isparam

s_param_report  istruc_param_report_destino
userobject iuo_userObject[],iuo_ctrl
//uo_control

s_parm istr_parm

datastore ids_report,ids_datastore
end variables

forward prototypes
public function long of_getcolor (string as_color)
public function integer of_loadlist ()
end prototypes

public function long of_getcolor (string as_color);Long ll_color

CHOOSE CASE Upper(as_color)
	CASE "BACKGROUND2"
		CHOOSE CASE iuo_parent.il_CurrentTheme
			CASE iuo_parent.BLUE
				ll_color = RGB(129,169,226)
			CASE iuo_parent.SILVER
				ll_color = RGB(153,151,181)
			CASE iuo_parent.OLIVE
				ll_color = RGB(183,198,145)
			CASE iuo_parent.CLASSIC
				ll_color = RGB(213,210,202)
		END CHOOSE
END CHOOSE

RETURN ll_color
end function

public function integer of_loadlist ();Long ll_index, ll_count
Long ll_imagelist
ListViewItem lvi

lv_1.DeleteItems()

ll_count = UpperBound(iuo_parent.is_images)

FOR ll_index = 1 TO ll_count	
	lv_1.AddLargePicture ( iuo_parent.is_images[ll_index] )	
NEXT

ll_count = UpperBound(iuo_parent.ist_tabs)

FOR ll_index = 1 TO ll_count
	lvi.Label = iuo_parent.of_GetText(ll_index)
	lvi.PictureIndex = iuo_parent.ist_tabs[ll_index].al_pic_index
	lvi.Data = ll_index
	lv_1.AddItem(lvi)
NEXT

FOR ll_index = 1 TO dw_1.rowcount()
//	
//	lvi.Label = iuo_parent.of_GetText(ll_index)
//	lvi.PictureIndex = iuo_parent.ist_tabs[ll_index].al_pic_index
//	lvi.Data = ll_index
	dw_1.object.lindex[ll_index]= ll_index
//	lv_1.AddItem(lvi)
NEXT

RETURN 1
end function

on w_paramreport.create
this.dw_1=create dw_1
this.lv_1=create lv_1
this.cb_3=create cb_3
this.cb_2=create cb_2
this.cb_1=create cb_1
this.uo_1=create uo_1
this.Control[]={this.dw_1,&
this.lv_1,&
this.cb_3,&
this.cb_2,&
this.cb_1,&
this.uo_1}
end on

on w_paramreport.destroy
destroy(this.dw_1)
destroy(this.lv_1)
destroy(this.cb_3)
destroy(this.cb_2)
destroy(this.cb_1)
destroy(this.uo_1)
end on

event open;istr_parm = Message.PowerObjectParm

iuo_parent = istr_parm.auo_tabcontrol
iuo_report = istr_parm.auo_userobject
ids_datastore  =  istr_parm.ads_menu  //aqui recibe el datastore del menu seleccionado
is_idmenu       = ids_datastore.object.Idmenu[1]
//is_idToolBar    =  ids_datastore.object.idToolBar[1]
//is_tab2   		   =  ids_datastore.object.tTab2[1]
//is_grilla 		   = ids_datastore.object.tDwGrid[1]
//is_entidad      = ids_datastore.object.tEntidad[1]
//if isnull(is_entidad) then is_entidad =''
//of_getwindow()




//il_menu = istruc_param_report_destino.ll_menu
//iuo_report = istruc_param_report_destino.uo_report   
//iuo_parent =istruc_param_report_destino.uo_control 
//
//

//uo_1.of_BackColor2(of_GetColor("BACKGROUND2"))
//uo_1.Resize(Width, Height)
//
of_LoadList()
dw_1.settransobject( sqlca)
dw_1.retrieve( is_idmenu,0);commit;
end event

type dw_1 from datawindow within w_paramreport
integer x = 18
integer y = 12
integer width = 1742
integer height = 876
integer taborder = 40
string title = "none"
string dataobject = "d_mreporte_grid"
boolean hscrollbar = true
boolean vscrollbar = true
boolean livescroll = true
borderstyle borderstyle = stylelowered!
end type

event clicked;
if row =0 then return
is_dw = this.object.tdw[row ]

is_titulo =  this.object.tdesc[row ]
is_window=this.object.twindow[row ]
ii_isparam =this.object.bparam[row ]
ii_report =this.object.idreport[row ]
end event

event rowfocuschanged;if currentrow < 1 then return
this.selectrow(0,FALSE)
this.selectrow(currentrow,true)

end event

type lv_1 from listview within w_paramreport
integer y = 1128
integer width = 1157
integer height = 900
integer taborder = 30
integer textsize = -10
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 33554432
borderstyle borderstyle = stylelowered!
listviewview view = listviewlist!
long largepicturemaskcolor = 536870912
long smallpicturemaskcolor = 536870912
long statepicturemaskcolor = 536870912
end type

type cb_3 from commandbutton within w_paramreport
integer x = 1810
integer y = 792
integer width = 494
integer height = 92
integer taborder = 40
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
string text = "Cerrar"
end type

event clicked;Close(PARENT)

end event

type cb_2 from commandbutton within w_paramreport
boolean visible = false
integer x = 1815
integer y = 172
integer width = 494
integer height = 92
integer taborder = 30
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
string text = "Cerrar Reporte"
end type

event clicked;ListViewItem lvi

lv_1.GetItem(lv_1.SelectedIndex(), lvi)

iuo_parent.of_CloseTab(Long(lvi.data ) )
//iuo_parent.of_CloseTab(ii_index )
of_LoadList()
end event

type cb_1 from commandbutton within w_paramreport
integer x = 1815
integer y = 40
integer width = 498
integer height = 92
integer taborder = 20
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
string text = "Abrir Reporte"
end type

event clicked;long ll_image,ll_index
window lw_window
string as_window
//ListViewItem lvi
//
//lv_1.GetItem(lv_1.SelectedIndex(), lvi)
//

//ll_image = iuo_parent.of_AddImage(is_rutaIcoSecu)//C:\PBGUIControls105\globe.ico
//ii_tabindex ++

if len(is_dw)=0 or isnull( is_dw ) then return

ll_index = iuo_parent.of_gettabcount( )
//iuo_parent.of_opentab( iuo_userObject[ll_index ],istr_parm, 'prueba_rep','', 'u_cst_dw_report')
//of_opentab( iuo_userObject[ii_tabindex ],istr_parm,'prueba_report','u_cst_dw_report',ll_image)
//
////uo_1.of_OpenTab(uo_mle_1, 'THIS IS A REALLY LONG TEXT HEADER IN ALL CAPS',1)
////uo_1.of_OpenTab(uo_mle_1, 'This is a really long text Header in all caps',1)
////uo_1.of_OpenTab(uo_mle_2, 'Tab Two',2)
////uo_1.of_OpenTab(uo_mle_3, 'Tab Three',3)
//iuo_parent.of_SelectTab(ii_tabindex)
//iuo_parent.of_SetStyle(iuo_parent.REGULAR)
//istr_parm.string_parm[1]=is_idmenu

//istr_parm.integer_parm[1]=ii_isparam
//istr_parm.integer_parm[2]=ii_report
istr_parm.ai_report = ii_report
istr_parm.as_report = is_dw
IF isnull(is_window) then is_window = ''
istr_parm.string_parm[1]=is_window  

iuo_report.dynamic event ue_tab( 'u_cst_report_main' ,istr_parm,is_titulo ,ii_report,ll_index ,iuo_ctrl)

Close(parent )




end event

type uo_1 from u_cst_statictext within w_paramreport
integer width = 2423
integer height = 1104
integer taborder = 10
long backcolor = 16777215
boolean #vgradientfill = true
end type

on uo_1.destroy
call u_cst_statictext::destroy
end on

